package org.example.mywebsite.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.mywebsite.entity.Essay;
import org.example.mywebsite.mapper.EssayMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/essay")
@Slf4j
@RequiredArgsConstructor
@Tag(name = "文章接口")
public class EssayController {

    private final EssayMapper essayMapper;

    @GetMapping("/list")
    @Operation(summary = "获取文章列表")
    public List<Essay> list(){
        log.info("获取文章列表");
        return essayMapper.selectList(null);
    }
}
